<template>
  <div>
    <el-button @click="ceshi">测试123</el-button>
    <!-- {{ watch }} -->
    <!-- <el-image
      style="width: 100px; height: 100px"
      src="http://kong-8000.pcloud.sunnyoptical.cn/crm-file/upload/file/upload/getFile2?path=/crmdata/crm-file/swipe/306b462abe474c72b8d158670d107858.png"
    >
      </el-image> -->
    <kunkka-only-form-dialog
      :form="form"
      :model="model"
      :action="action"
      :name="name"
      :upload-action="uploadAction"
      @toggleClick="toggleClick"
      @handleFileUploadPreview="handleFileUploadPreview"
      @srmDownloadFile="srmDownloadFile"
    >
      <template v-slot:design>
        <div>
          <p style="padding-left:50px">666</p>
        </div>
      </template>
    </kunkka-only-form-dialog>

    <!-- <kunkka-tinymce /> -->
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
  data() {
    return {
      name: 'test',
      action:
        'https://imhome.sunnyoptical.cn/impreset-pro/file/upload/cloudUploadFile',
      uploadAction:
        'https://imhome.sunnyoptical.cn/impreset-pro/file/upload/getcloudviewFile',
      form: [],
      timelineList: null,
      rightComplete: false,
      leftComplete: false
    }
  },
  computed: {
    // ...mapGetters(['name'])
  },
  mounted() {},
  methods: {
    ceshi: function() {
      this.$store.dispatch('kunkkaOnlyFormDialog/toggleSetModel', {
        visible: true,
        uid: '1111',
        handle: [
          {
            label: 'add',
            handle: 'app/test'
          }
        ],
        conditions: [
          {
            label: '工号111',
            prop: 'gonghao',
            type: 'input',
            filter: 'toUpperCaseAndNum',
            show: true
          },
          {
            label: '姓名',
            prop: 'gonghao',
            type: 'input',
            show: true
          },
          {
            label: '日期',
            prop: 'datetime',
            type: 'datetime',
            show: true,
            pickerOptions: {
              disabledDate: time => {
                return time.getTime() < new Date().getTime()
              }
            }
          },
          {
            label: '人员选择',
            prop: 'selectPeople',
            type: 'selectPeople',
            show: true,
            single: true,
            filter: true
          },
          {
            label: '附件',
            prop: 'uploadFile',
            type: 'srmUploadFile',
            show: true
          }
          // {
          //   label: '日期',
          //   prop: 'date',
          //   type: 'date',
          //   show: true
          // },
          // {
          //   label: '日期时间',
          //   prop: 'datetime',
          //   type: 'datetime',
          //   show: true
          // },
          // {
          //   label: '日期span',
          //   prop: 'spandate',
          //   type: 'spandate',
          //   show: true
          // },
          // {
          //   label: '日期时间span',
          //   prop: 'test',
          //   type: 'fileUpload',
          //   name: 'test',
          //   show: true
          // },
          // {
          //   label: '文本编辑器',
          //   prop: 'tinymce',
          //   type: 'tinymce',
          //   name: 'tinymce',
          //   disabled: true,
          //   show: true
          // }
        ],
        model: {
          gonghao: '',
          datetime: '',
          date: '',
          spandate: '2021-04-27 19:00:00',
          spandatetime: ['wenjianm,sunnylink/test/5e657227777f47a4bcc1ad6ee5cf7fa1.docx'],
          test: ['wenjianm,sunnylink/test/5e657227777f47a4bcc1ad6ee5cf7fa1.docx'],
          selectPeople: [],
          uploadFile: 'http://speed.hetzner.de/100MB.bin'
        }
        // watch: {
        //   select: {
        //     0: {
        //       show: [],
        //       hide: ['gzms', 'ghsb'],
        //       required: ['wbbjq'],
        //       norequired: []
        //     },
        //     1: {
        //       show: ['gzms', 'ghsb'],
        //       hide: [],
        //       required: ['gzms', 'ghsb'],
        //       norequired: ['wbbjq']
        //     }
        //   }
        // }
      })
    },
    toggleClick() {
      console.log('get')
    },
    handleFileUploadPreview(file) {

    },
    srmDownloadFile(data) {
      console.log(data)
    }
  }
}
</script>
<style lang="scss">
.Kunkka-collapse-form {
  .el-form-item--mini.el-form-item {
    margin-bottom: 0;
  }
}
</style>
